def ordered(array, len):
	i = 1
	while i < len:
		if array[i-1]>array[i]:
			return False
		i += 1
	return True
class SocketBase(object):

    def __init__(self, zmq_socket_type, context=None):
        self._context = context or Context.get_instance()
        self._events = Events(zmq_socket_type, context)

    def close(self):
        self._events.close()

    def connect(self, endpoint, resolve=True):
        return self._events.connect(endpoint, resolve)

    def bind(self, endpoint, resolve=True):
        return self._events.bind(endpoint, resolve)

try:
    # 2.6 will have a json module in the stdlib
    from json import loads as json_loads
except ImportError:
    try:
        # simplejson is popular and pretty good
        from simplejson import loads as json_loads
    # fall back on local parser otherwise
    except ImportError:
        json_loads = _loads



